#include <iostream>
#include "SymbolVar.hpp"
#include "Expression.hpp"

SymbolVar::SymbolVar(Type*t, int identValue)
{
	this->t = t;
	this->expression = new Expression(t, identValue);
}

SymbolVar::~SymbolVar(){
	delete t;
}

void SymbolVar::show(){
	std::cout << "variable\t" ;
	std::cout << "type:" ;
	if (t != NULL) {
		t->show();
	}
}

Symbol *  SymbolVar::clone(){
	return new SymbolVar(t->clone(), expression->getIdentTempResult());
}

Expression * SymbolVar::getExpression() {
	return this->expression->clone();
}

void SymbolVar::setExpression(Expression * e) {
	this->expression = e;
}
bool SymbolVar::hasExpression() {
	return true;
}



SymbolRecord::SymbolRecord(Type*t, int pos)  {
	this->t = t;
	this->position = pos;
}

SymbolRecord::~SymbolRecord(){
	delete t;
}

void SymbolRecord::show(){
	std::cout << "champs\ttype:" ;
	t->show();
	std::cout << ",position:" << this->position;
}

Symbol *  SymbolRecord::clone(){
	return new SymbolRecord(t->clone(), position);
}

